<template>
    <div class="wrapper">
        <mt-header title="可用" class="no-bg">
            <mt-button icon="back" slot="left" @click="$router.push('/account/wallet')"></mt-button>
            <mt-button slot="right" @click="$router.push('/account/wallet/order')">记录</mt-button>
        </mt-header>
        <div class="content">
            <div class="text">可用(DLB)</div>
            <div class="money">{{walletInfo && walletInfo.availableDlb}}</div>
        </div>
        <div class="default-btn">
            <mt-button type="primary" size="large" @click.native="changeToCash" :disabled="(userInfo && userInfo.payPassword=='0' && walletInfo.availableDlb >= 1)?false:true">提现</mt-button>
        </div>
        <div class="tips" v-show="userInfo && userInfo.payPassword=='1'" @click="$router.push('/account/setting/editPayPwd')">
            <div>未设置支付密码？点击前往设置 >></div>
        </div>
    </div>
</template>

<script>
import { mapGetters } from 'vuex'
import { Toast, MessageBox } from 'mint-ui';
export default {
  data: function () {
    return {

    }
  },
  computed: {
    ...mapGetters([
      'userInfo',
      'walletInfo'
    ])
  },
  mounted(){
      console.log(this.walletInfo);
  },
  methods: {
    changeToCash(){   //跳转到提现页面
        // Toast({
        //     message: "提现前需要进行实名验证，该功能将在APP正式上线时启用"
        // });

        MessageBox({
            title:'',
            message: '提现前需要进行实名验证，该功能将在APP正式上线时启用',
            closeOnClickModal:true,
            showCancelButton:false,
        })
    //   判断是否设置支付密码
    //   if( this.userInfo && this.userInfo.payPassword == "1" ){
    //       //未设置：跳转到设置支付密码页面
    //       this.$router.push({
    //           name : 'editPayPwd',
    //           query:{
    //             from : 'usable'
    //           }
    //       })
    //   }else{
    //       //已设置
    //       this.$router.push('/account/wallet/tocash');
    //   }
    }
  }
}
</script>

<style lang="stylus" scoped>
.wrapper{
    .content{
        margin-top:20px;
        padding:0 15px;
        .text{
            color:#bfbfbf;
            font-size: 13px;
        }
        .money{
            margin-top: 30px;
            font-weight: bold;
            text-align: center;
            color:#333333;
            font-size: 24px;
        }
    }
    .default-btn{
        margin-top:40px;
    }
    .tips{
        padding:0 15px;
        margin-top:10px;
        color:#ec3333;
        font-size:12px;
    }
}
</style>
